package com.skh.design;

/**
 * @Author: skh
 * @Date: 2019/4/15 16:50
 * @Description: 双重校验-单例模式
 */
public class UniqueInstance {

    private static volatile UniqueInstance instance;

    public static UniqueInstance getInstance(){
        if (instance == null) {
            synchronized (UniqueInstance.class) {
                if (instance == null) {
                    instance = new UniqueInstance();
                }
            }
        }
        return instance;

    }

}
